<?php
// $Id$

/**
 * Controller_Admin_Users 控制器
 */
class Controller_Admin_Users extends Controller_Abstract
{

	function actionIndex()
	{
        // 为 $this->_view 指定的值将会传递数据到视图中
		# $this->_view['text'] = 'Hello!';
	}
	function actionlist()
	{
		$this->union_table = Userbase::meta();
		$this->lists();
	}
	
	function actionlock()
	{
		if ($this->_context->isPOST())
		{
			$ids = isset($this->_context->ids)?$this->_context->ids:NULL;
			if (is_null($ids))
			{
				return $this->error('没有数据提交');
			}else
			{
				$num = Userbase::lock_user($ids);
				if ( $num == 0)
				{
					return $this->error('修改失败');
				}else 
				{
					return $this->success($num.' 条记录被更新');
				}
			}
		}else
		{
			return $this->error('数据提交方式不正确');
		}
	}
	function actiontree()
	{
		$userid = isset($this->_context->userid)?trim($this->_context->userid):NULL;
		if (is_null($userid))
		{
			exit('错误的用户账号');
		}else
		{
			$this->_view['item'] = Userbase::recursion($userid);
			$this->_view['userid'] = $userid;
		}
	}
}


